/*
 * CGraphicEngine.h
 *
 *  Created on: 26.04.2009
 *      Author: markus
 */

#ifndef CGRAPHICENGINE_H_
#define CGRAPHICENGINE_H_

#include <Ogre.h>
#include "../src/ErrorOutputs.h"
#include "CInputFrameListener.h"
#include "ConfigStructs.h"
#include <../../SDL/include/SDL/SDL.h>
#include <../../SDL/include/SDL/SDL_syswm.h>
#include "../Physics/CPhysicsMain.h"


class CGraphicEngine
{
private:
	Ogre::Root *m_OgreRoot;
        LivingObject *m_playerObject;
	Ogre::RenderWindow *m_RenderWindow;
        std::list<BaseObject*> *m_ObjectList;

public:
	CGraphicEngine();
	~CGraphicEngine();

        void setup(std::list<BaseObject*> *lstLivingObj, ConfigContainer configContainer, Ogre::FrameListener *frameListener); // creates the root object and handles all other startup functions
        void executeRenderLoop(CPhysicsMain *physicsWorld);
        /**
          prepares a new graphics object, that can be added or remove by addObject() or removeObject()
          */
        void prepareObject(BaseObject *object);

        /**
          adds a new object to the graphics world
          */
        void addObject(BaseObject *object);

        /**
          removes an object from the graphics world
          */
        void removeObject(BaseObject *object);

private:
        void loadResources(void);
        void createScene(void);
	bool createFrameListeners(KeyMapping *keyMapping);
};

#endif /* CGRAPHICENGINE_H_ */
